function picTurn(){
	var container=document.getElementById("bf");
    var prev=document.getElementById("left-btn");
    var next=document.getElementById("right-btn");
    var elem=document.getElementById("div-pic");
    var btns=document.getElementById("ctrl-btn").getElementsByTagName("li");
    var intervals=4000;
    var len=5;
    var animated=false;
    var timer;
    var index=1;
    function move(offset){
    	if(offset==0){
    		return;
    	}
    	var left=parseInt(elem.style.left)+offset;
    	animated=true;
        elem.style.left=left+'px';
                        if(left>0){
                            elem.style.left = -1349 * (len-1) + 'px';
                        }
                        if(left<(-1349 * (len-1))){
                            elem.style.left = '0px';
                        }
        animated=false;
    }
    function showButton(){
    	for(var i=0;i<btns.length;i++){
    		if(btns[i].className=='on'){
    			btns[i].className='';
    			break;
    		}
    	}
    	btns[index-1].className='on';
    }
    function play(){
    	timer=setTimeout(function(){
    		next.onclick();
    		play();
    	},intervals);
    }
    function stop(){
    	clearTimeout(timer);
    }
    next.onclick=function(){
         if(animated){
         	return;
         }
         if(index==5){
         	index=1;
         }else{
         	index+=1;
         }
         move(-1349);
         showButton();
    }
    prev.onclick=function(){
    	if(animated){
    		return;
    	}
    	if(index==1){
    		index=5;
    	}else{
    		index-=1;
    	}
    	move(1349);
    	showButton();
    }
    for(var i=0;i<btns.length;i++){
    	btns[i].onclick=function(){
    		if(animated){
    			return;
    		}
    		if(this.className=='on'){
    			return;
    		}
    		var myIndex=parseInt(this.getAttribute('index'));
    		var offset=-1349*(myIndex-index);
    		move(offset);
    		index=myIndex;
    		showButton();

    	}
    }
    container.onmouseover=stop;
    container.onmouseout=play;
    play();
    return false;
}